<div class="tctj tctj-day bgwhite">
  <div nz-row>
    <div nz-col nzSpan="24">
      <div class="queryBar">
        <span class="queryLabel">统计时间：</span>
        <nz-date-picker [(ngModel)]="queryParam._workdateStart" nzFormat="yyyy-MM-dd" nzPlaceHolder="开始时间">
        </nz-date-picker>
        <nz-date-picker [(ngModel)]="queryParam._workdateEnd" nzFormat="yyyy-MM-dd" nzPlaceHolder="结束时间">
        </nz-date-picker>

        <button nz-button nzType="primary" (click)="setQueryDate('day')"><i nz-icon nzType="search"></i>本日</button>
        <button nz-button nzType="primary" (click)="setQueryDate('month')"><i nz-icon nzType="search"></i>本月</button>
        <button nz-button nzType="primary" (click)="setQueryDate('year')"><i nz-icon nzType="search"></i>本年</button>

        <button nz-button nzType="primary" (click)="query()"><i nz-icon nzType="book"></i>统计</button>
        <button nz-button nzType="primary" (click)="export()"><i nz-icon nzType="export"></i>导出</button>
      </div>
    </div>
  </div>
  <div nz-row>
    <div nz-col nzSpan="24">
      <h3 class="title">昆明集团公司电务系统天窗日统计（{{titleDate|date:"yyyy年MM月dd日"}}）</h3>
      <table class="table text-center">
        <tr>
          <td class="center lable leftLable" rowspan="2" nzWidth="width: 10em;">单位</td>
          <td class="center lable" colspan="6">施工</td>
          <td class="center lable" colspan="6">维修</td>
          <td class="center lable" colspan="2">点外</td>
        </tr>
        <tr>
          <!-- 施工 -->
          <td class="center lable">计划项数</td>
          <td class="center lable">兑现项数</td>
          <td class="center lable">兑现率</td>
          <td class="center lable">计划时间</td>
          <td class="center lable">兑现时间</td>
          <td class="center lable">兑现率</td>

          <!-- 维修 -->
          <td class="center lable">计划项数</td>
          <td class="center lable">兑现项数</td>
          <td class="center lable">兑现率</td>
          <td class="center lable">计划时间</td>
          <td class="center lable">兑现时间</td>
          <td class="center lable">兑现率</td>

          <!-- 点外 -->
          <td *ngIf="!isRange" class="center lable">今天</td>
          <td *ngIf="!isRange" class="center lable">明天</td>
          <td *ngIf="isRange" class="center lable">期间</td>
        </tr>
        <tr *ngFor="let item of tableData">
          <td class="center leftLable text-left" [style.paddingLeft]="item._leftSpace+'em'">
            <a *ngIf="item.unit.indexOf('STA')==-1" href="javascript:void(0)"
              (click)="expand(item.unit)">{{item.orgName}}</a>
            <span *ngIf="item.unit.indexOf('STA')!=-1">{{item.orgName}}</span>
          </td>
          <!-- 施工 -->
          <td>
            <a href="javascript:void(0)" (click)="getDetail(item.unit,'A')">{{item.sgPlanCou}}</a>
          </td>
          <td>
            <a href="javascript:void(0)" (click)="getDetail(item.unit,'B')">{{item.sgPlanCash}}</a>
          </td>
          <td>{{item.sgPlanCashRate}}</td>
          <td nzAlign="center">
            {{item.sgTime}}
          </td>
          <td nzAlign="center">
            {{item.sgTimeCash}}
          </td>
          <td nzAlign="center">{{item.sgTimeCashRate}}</td>

          <!-- 维修 -->
          <td>
            <a href="javascript:void(0)" (click)="getDetail(item.unit,'C')">{{item.wxPlanCou}}</a>
          </td>
          <td>
            <a href="javascript:void(0)" (click)="getDetail(item.unit,'D')">{{item.wxPlanCash}}</a>
          </td>
          <td>{{item.wxPlanCashRate}}</td>
          <td nzAlign="center">{{item.wxTime}}</td>
          <td nzAlign="center">{{item.wxTimeCash}}</td>
          <td nzAlign="center">{{item.wxTimeCashRate}}</td>

          <!-- 点外 -->
          <td *ngIf="!isRange">
            <a href="javascript:void(0)" (click)="getDetail(item.unit,'E')">{{item.dwTodayCou}}</a>
          </td>
          <td *ngIf="!isRange">
            <a href="javascript:void(0)" (click)="getDetail(item.unit,'F')">{{item.dwTommrowCou}}</a>
          </td>
          <td *ngIf="isRange">
            <a href="javascript:void(0)" (click)="getDetail(item.unit,'G')">{{item.dwCou}}</a>
          </td>
        </tr>


        <!-- 合计 -->
        <tr>
          <td class="leftLable">合计</td>
          <!-- 施工 -->
          <td>{{tableDataSum.sgPlanCou}}</td>
          <td>{{tableDataSum.sgPlanCash}}</td>
          <td>{{tableDataSum.sgPlanCashRate}}</td>
          <td>{{tableDataSum.sgTime}}</td>
          <td>{{tableDataSum.sgTimeCash}}</td>
          <td>{{tableDataSum.sgTimeCashRate}}</td>

          <!-- 维修 -->
          <td>{{tableDataSum.wxPlanCou}}</td>
          <td>{{tableDataSum.wxPlanCash}}</td>
          <td>{{tableDataSum.wxPlanCashRate}}</td>
          <td>{{tableDataSum.wxTime}}</td>
          <td>{{tableDataSum.wxTimeCash}}</td>
          <td>{{tableDataSum.wxTimeCashRate}}</td>

          <!-- 点外 -->
          <td *ngIf="!isRange">{{tableDataSum.dwTodayCou}}</td>
          <td *ngIf="!isRange">{{tableDataSum.dwTommrowCou}}</td>
          <td *ngIf="isRange">{{tableDataSum.dwCou}}</td>
        </tr>
        <tr>
          <td class="leftLable">未兑现</td>
          <td colspan="14">
            <div [innerHtml]="tableInfo.wdxStr" class="text-left scroll"></div>
          </td>
        </tr>
        <tr>
          <td class="leftLable">多、少给点</td>
          <td colspan="14" class="text-left">
            <span>施工：</span><span></span>
            <br>
            <span>维修：</span>
            <br>
            <span>I级：</span><span></span>
            <span>II级：</span><span></span>
          </td>
        </tr>
        <tr>
          <td class="leftLable">小于30分钟天窗及原因</td>
          <td colspan="14" class="text-left"></td>
        </tr>
      </table>
    </div>
  </div>
</div>

<nz-modal [(nzVisible)]="detail.visible" nzTitle="详情" (nzOnCancel)="detailCancel()" [nzFooter]="detail.footer"
  [nzBodyStyle]="{width: '1200px'}" nzWidth="1200px" class="modalPanel tctj tctj-day">
  <nz-table *ngIf="!['E','F','G'].includes(detail.tableType)" #basicTable [nzData]="detail.tableData" nzSize="small"
    [nzLoadingDelay]="1000" nzBordered [nzShowPagination]="false" [nzFrontPagination]="false"
    [nzScroll]="lockHeadScroll">
    <thead>
      <tr>
        <th nzWidth="100px" nzAlign="center">作业类型</th>
        <th nzWidth="100px" nzAlign="center">作业日期</th>
        <th nzAlign="center">作业项目</th>
        <th nzWidth="100px" nzAlign="center">作业级别</th>
        <th nzWidth="150px" nzAlign="center">作业地点</th>
        <th nzWidth="100px" nzAlign="center">作业开始时间</th>
        <th nzWidth="100px" nzAlign="center">作业结束时间</th>
        <th nzWidth="100px" nzAlign="center">作业线路</th>
        <th nzWidth="100px" nzAlign="center">作业负责人</th>
        <th nzWidth="100px" nzAlign="center">作业行别</th>
      </tr>
    </thead>
    <tbody>
      <tr *ngFor="let data of basicTable.data;index as i">
        <td>
          <!-- {{data.vcType}} -->
          <div class="cmiddle" style="max-height:105px;">{{data.vcType}}</div>
        </td>
        <td nzAlign="center">
          <!-- {{data.dtWorkday}} -->
          <div class="cmiddle" style="max-height:105px;">{{data.dtWorkday}}</div>
        </td>
        <td>
          <div class="cmiddle" style="max-height:105px;">{{data.vcProject}}</div>
        </td>
        <td nzAlign="center">
          <!-- {{data.vcLevel}} -->
          <div class="cmiddle" style="max-height:105px;">{{data.vcLevel}}</div>
        </td>
        <td nzAlign="center">
          <div class="cmiddle" style="max-height:105px;">{{data.vcWorkplace}}</div>
        </td>
        <td nzAlign="center">
          <!-- {{data.vcSkywinstime}} -->
          <div class="cmiddle" style="max-height:105px;">{{data.vcSkywinstime}}</div>
        </td>
        <td nzAlign="center">
          <!-- {{data.vcSkywinetime}} -->
          <div class="cmiddle" style="max-height:105px;">{{data.vcSkywinetime}}</div>
        </td>
        <td>
          <!-- {{data.vcSgroute}} -->
          <div class="cmiddle" style="max-height:105px;">{{data.vcSgroute}}</div>
        </td>
        <td nzAlign="center">
          <!-- {{data.vcWaperson}} -->
          <div class="cmiddle" style="max-height:105px;">{{data.vcWaperson}}</div>
        </td>
        <td>
          <!-- {{data.vcSgdirectoryname}} -->
          <div class="cmiddle" style="max-height:105px;">{{data.vcSgdirectoryname}}</div>
        </td>
      </tr>
    </tbody>
  </nz-table>


  <nz-table *ngIf="['E','F','G'].includes(detail.tableType)" #basicTable [nzData]="detail.tableData" nzSize="small"
    [nzLoadingDelay]="1000" nzBordered [nzShowPagination]="false" [nzFrontPagination]="false"
    [nzScroll]="lockHeadScroll">
    <thead>
      <tr>
        <th nzWidth="100px" nzAlign="center">作业日期</th>
        <th nzAlign="center">作业项目</th>
        <th nzWidth="150px" nzAlign="center">作业地点</th>
        <th nzWidth="120px" nzAlign="center">作业开始时间</th>
        <th nzWidth="120px" nzAlign="center">作业结束时间</th>
        <th nzWidth="100px" nzAlign="center">作业负责人</th>
        <th nzWidth="150px" nzAlign="center">命令号</th>
        <th nzWidth="100px" nzAlign="center">部门</th>
      </tr>
    </thead>
    <tbody>
      <tr *ngFor="let data of basicTable.data;index as i">
        <td nzAlign="center">
          <!-- {{data.dtWorkday}} -->
          <div class="cmiddle" style="max-height:105px;">{{data.dtWorkday}}</div>
        </td>
        <td>
          <div class="cmiddle" style="max-height:105px;">{{data.vcProject}}</div>
        </td>
        <td nzAlign="center">
          <div class="cmiddle" style="max-height:105px;">{{data.vcWorkplace}}</div>
        </td>
        <td nzAlign="center">
          <!-- {{data.vcSkywinstime}} -->
          <div class="cmiddle" style="max-height:105px;">{{data.vcSkywinstime}}</div>
        </td>
        <td nzAlign="center">
          <!-- {{data.vcSkywinetime}} -->
          <div class="cmiddle" style="max-height:105px;">{{data.vcSkywinetime}}</div>
        </td>
        <td nzAlign="center">
          <!-- {{data.vcWaperson}} -->
          <div class="cmiddle" style="max-height:105px;">{{data.vcWaperson}}</div>
        </td>
        <td nzAlign="center">
          <!-- {{data.code}} -->
          <div class="cmiddle" style="max-height:105px;">{{data.code}}</div>
        </td>
        <td nzAlign="center">
          <!-- {{data.workOrg}} -->
          <div class="cmiddle" style="max-height:105px;">{{data.workOrg}}</div>
        </td>
      </tr>
    </tbody>
  </nz-table>

</nz-modal>